#!/usr/bin/ruby
# -*- ruby -*-
#
# http://programmingpraxis.com/2012/12/25/the-twelve-days-of-christmas/

def gifts(n, sum = 0)
    return n > 0 ? gifts(n - 1, sum + n) : sum
end

puts (1 .. 12).to_a.inject(0) { |r, i| r + gifts(i) }
